package zmz.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zmz.dao.StudentMapper;
import zmz.entity.Student;
import zmz.entity.Teacher;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Autowired
    private TeacherService teacherService;

    @Override
    @Transactional
    public int createStudent(Student student) {
        studentMapper.insertSelective(student);
        Teacher t = new Teacher();
        t.setTid(2);
        t.setTname("ma yun");
        t.setTpwd(23);

        teacherService.createTeacher(t);

        return 0;
    }
}
